<?php

class Kzend_DbManager
{
    /**
     * Singleton instance
     */
    protected static $_instance = null;

    /**
     * @var Zend_Db_Adapter_Abstract
     */
    protected $_db = null;

    public static function getInstance()
    {
        if (self::$_instance === null) {
            self::$_instance = new self();
        }

        return self::$_instance;
    }

    public function initDatabase($adapter, $dbParams)
    {
        $db = Zend_Db::factory($adapter, $dbParams);
        $db->setFetchMode(Zend_Db::FETCH_OBJ);
        Zend_Db_Table_Abstract::setDefaultAdapter($db);

        $this->_db = $db;
    }

    public function getDbAdapter()
    {
        return $this->_db;
    }
}
